//
//  CanHelpPeopleCollectionViewCell.m
//  MyProject
//
//  Created by jiaming yan on 2018/3/2.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "CanHelpPeopleCollectionViewCell.h"

@implementation CanHelpPeopleCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.headImageView.layer.borderColor = UIColorFromRGB(0Xcbf2f5).CGColor;
    self.headImageView.layer.borderWidth = 1;
    
    self.nameL.lineBreakMode = NSLineBreakByWordWrapping;
}

- (void)setModel:(IncumbentModel *)model {
    _model = model;
    
    [self.headImageView sd_setImageWithURL:ImageURLWithKey(model.headImg) placeholderImage:PlaceholderImagePeople];
    
    if (model.hasAssurePassService) {
        self.ensureImageView.hidden = NO;
    } else {
        self.ensureImageView.hidden = YES;
    }
    
    self.nameL.text = model.nickName;
    self.positionL.text = model.positionName;
    
    NSDateFormatter *ft = [[NSDateFormatter alloc] init];
    [ft setDateFormat:@"YYYY"];
    NSDate *dateNow = [NSDate date];
    NSString *currentTimeStr = [ft stringFromDate:dateNow];
    NSInteger time = [currentTimeStr integerValue] - [model.entryTime integerValue];
    self.yearPeopleL.text = [NSString stringWithFormat:@"在职%zd年|帮助过%@人", time, model.helpedCount];
    self.companyL.text = model.companyName;
}

@end
